<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="../../../yl/index.css" />
    <link rel="stylesheet" href="../../../style/index.css" />
    <title>销售订单</title>
    <style>
        .el-descriptions__label {
            width: 120px;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="title">
            <div style="padding: 5px;">
                用户姓名<el-input v-model="page.value1" clearable style="width: 200px; margin:0 10px; "
                    placeholder="请输入用户姓名"></el-input>
                <el-button icon="Search" style="margin: 0; margin-right: 10px;" @click="check">查询</el-button>
                <el-button icon="Refresh" style="margin: 0; margin-right: 10px;" @click="reset">重置</el-button>
                <!-- <el-button type="success" icon="Upload" style="margin: 0; margin-right: 10px;" @click="personalAdd"
                    plain round>批量导出</el-button>
                <el-button type="danger" icon="Delete" style="margin: 0; margin-right: 10px;" @click="personalAdd" plain
                    round>批量删除</el-button> -->
            </div>
        </div>
        <div class="body">
            <!-- <div class="left">
                <el-tree ref="tree" default-expand-all :expand-on-click-node="false" id="tree" style="max-width: 600px"
                    :data="treeData" @node-click="handleNodeClick" :props="{ label: 'Province' }">
                    <template #default="{ node, data }">
                        <div class="custom-tree-node">
                            <span>{{ node.label }}</span>
                        </div>
                    </template>
                </el-tree>
            </div> -->
            <div class="right">
                <el-table id="table" border
                    :data-options="JSON.stringify({ 'TableName': 'sales_order','primary_key':'Sales_Order_SerialNumber'})"
                    height="450" v-loading="loading" ref="multipleTable" tooltip-effect="dark" :data="Tabletdata"
                    @selection-change="handleSelectionChange">
                    <el-table-column min-width="180" v-for="column in columns" :key="column.COLUMN_NAME"
                        :prop="column.COLUMN_NAME" :label="column.COLUMN_COMMENT">
                        <template v-slot="{row}">
                            <div v-if="isValueType(row[column.COLUMN_NAME])=='image'">
                                <el-image style="width: 100px; height: 100px" :src="photo + row[column.COLUMN_NAME]"
                                    fit="contain"></el-image>
                            </div>
                            <template v-else>
                                {{row[column.COLUMN_NAME]}}
                            </template>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" fixed="right" width="180">
                        <template #default="{row}">
                            <div style="display: flex; align-items: center;">
                                <el-button style="margin-right: 10px;" size="small" @click="handlePoints(row)">
                                    积分详情
                                </el-button>
                                <el-dropdown trigger="click">
                                    <el-button type="danger" size="small">
                                        更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
                                    </el-button>
                                    <template #dropdown>
                                        <el-dropdown-menu>
                                            <el-dropdown-item @click="handleAddPoints(row)">
                                                积分发放
                                            </el-dropdown-item>
                                            <el-dropdown-item @click="handleSubPoints(row)">
                                                积分扣减
                                            </el-dropdown-item>
                                        </el-dropdown-menu>
                                    </template>
                                </el-dropdown>
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination style="margin-top: 1%;" :current-page="page.PageNumber" :page-size="page.RowAmount"
                    :page-sizes="[10, 100, 200, 300, 400]" layout="total, sizes, prev, pager, next, jumper"
                    :total="Total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
            </div>
        </div>
        <el-dialog v-model="showDialog"  width="800" class="custom-dialog" :destroy-on-close="true"
        :close-on-click-modal="false">
            <template #header>
                <div class="dialog-header">
                    <span>积分</span>
                </div>
            </template>
            <el-form :model="form1" ref="form" :inline-message="true" style="width: 100%"> 
                <el-descriptions style="width: 100%;margin-left: 10px;" :column="2" size="large" border>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">积分类型</div>
                        </template>
                        <el-form-item prop="Points_Type" style="margin-bottom: 0;"
                            :rules="[{ required: true, message: '请选择积分类型', trigger: 'change' }]">
                            <el-select v-model.trim="form1.Points_Type" placeholder="请选择积分类型" style="width: 100%">
                                <el-option v-for="(item,index) in [{value:'0',label:'村民积分'},{value:'1',label:'党员积分'}]"
                                    :key="index" :label="item.label" :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">当前剩余积分</div>
                        </template>
                        <el-form-item prop="Remain_Points" style="margin-bottom: 0;">
                            {{form1.Points_Type=='0'?form.Villager_Remain_Points:form.Party_Remain_Points}}
                        </el-form-item>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">修改积分</div>
                        </template>
                        <el-form-item prop="Type" style="margin-bottom: 0;">
                            <el-radio-group v-model="form1.Type">
                                <el-radio label="0">增加</el-radio>
                                <el-radio label="1">减少</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">积分</div>
                        </template>
                        <el-form-item prop="Points" style="margin-bottom: 0;">
                            <el-input-number v-model.trim="form1.Points" :min="1"></el-input-number>
                        </el-form-item>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">备注</div>
                        </template>
                        <el-form-item prop="Notes" style="margin-bottom: 0;">
                            <el-input type="textarea" :autosize="{ minRows: 2}" v-model="form1.Notes"
                                class="borderless-input" placeholder="可输入备注" />
                        </el-form-item>
                    </el-descriptions-item>
                </el-descriptions>
                <el-descriptions style="width: 100%;margin-left: 10px;" :column="2" size="large" border>
                    <el-descriptions-item>
                        <template #label>
                            <div class="cell-item">附件</div>
                        </template>
                        <yl-upload ref="ylUpload" drag @success="success" @remove="remove" :limit="99" :file="fileList"></yl-upload>
                    </el-descriptions-item>
                </el-descriptions>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="showDialog = false" class="cancel-btn">取消</el-button>
                    <el-button type="primary" :loading="loading" @click="handleSubmit" class="confirm-btn">提交</el-button>
                </div>
            </template>
        </el-dialog>
    </div>
    </div>
    <script src="../../../utils/utils.js"></script>
    <script src="../../../config/config.js"></script>
    <script src="../../../utils/mixins.js"></script>
    <script src="../../../yl/vue.js"></script>
    <script src="../../../yl/index.js"></script>
    <script src="../../../yl/zh-cn.mjs"></script>
    <script src="../../../yl/index.iife.min.js"></script>
    <script src="../../../yl/jquery.min.js"></script>
    <script src="../../../utils/jquery.cookie.js"></script>
    <script src="../../../api/request.js"></script>
    <script src="js/index.js"></script>
</body>

</html>